package com.yh.controller;


import com.yh.core.respones.Result;
import com.yh.core.respones.ResultBuilder;
import com.yh.core.respones.ResultEnum;
import com.yh.entity.Account;
import com.yh.service.IAccountService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 账户 前端控制器
 * </p>
 *
 * @author 小鬼
 * @since 2019-09-16
 */
@RestController
@RequestMapping("/account")
public class AccountController {

    @Resource
    IAccountService accountService;

    @RequiresPermissions("user:getAccountById")
    @GetMapping("getAccountById")
    public Result getAccountById(Integer id) {

        return ResultBuilder.success(accountService.getById(id));
    }

    @GetMapping("/403")
    public Result getAccount() {

        return ResultBuilder.errorInfo(ResultEnum.UNAUTHORIZED);
    }
}
